from flask import Flask, jsonify

app = Flask(__name__)

# 假设你有一个名为 "res" 的字典
res = {
    "data_json": {"key1": "value1", "key2": "value2"},
    "name": "myMindMap",
    "path": "/path/to/save"
}

def dict2xmind(dicts, filename, path):
    # ...此处是dict转换为思维导图文件的逻辑...
    status = convert_to_xmind(dicts, filename, path)
    return status  # 返回操作结果

@app.route('/generate_mindmap')
def generate_mindmap():
    status = dict2xmind(res["data_json"], res["name"], res["path"])
    response = jsonify(code=200, status=status, message='ok', data="Successfully Generating File.")
    return response

if __name__ == '__main__':
    app.run()